﻿using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Audio;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VRB_0._1
{
    class MapSelectScreen
    {
        public enum MapSelectChoice
        {
            TESTMAP = 1, TESTMAP2 = 2, BACK = 3
        }

        protected SpriteFont font;
        protected MapSelectChoice currentChoice;
        protected Texture2D selector;
        protected Texture2D background;
        protected Texture2D testMapShot;
        protected Texture2D testMap2Shot;

        protected SoundEffect back;
        protected SoundEffect choose;

        public void Initialize(ContentManager Content)
        {
            font = Content.Load<SpriteFont>("gameFont");
            selector = Content.Load<Texture2D>("selector");
            background = Content.Load<Texture2D>("meny");
            testMapShot = Content.Load<Texture2D>("testmapshot");
            testMap2Shot = Content.Load<Texture2D>("testmap2shot");

            choose = Content.Load<SoundEffect>("choice");
            back = Content.Load<SoundEffect>("back");

            currentChoice = MapSelectChoice.TESTMAP;
        }

        public void Draw(SpriteBatch spriteBatch, Viewport Viewport)
        {
            spriteBatch.Draw(background, Vector2.Zero, Color.White);
            spriteBatch.DrawString(font, "Ducttapez",
                        new Vector2(Viewport.TitleSafeArea.X + 50, Viewport.TitleSafeArea.Y + 200), Color.White);
            spriteBatch.DrawString(font, "Testmap2",
                        new Vector2(Viewport.TitleSafeArea.X + 50, Viewport.TitleSafeArea.Y + 300), Color.White);
            spriteBatch.DrawString(font, "Back",
                        new Vector2(Viewport.TitleSafeArea.X + 50, Viewport.TitleSafeArea.Y + 400), Color.White);
            spriteBatch.Draw(selector, new Vector2(Viewport.TitleSafeArea.X + 15, Viewport.TitleSafeArea.Y + 105 + 100 * (int)currentChoice), Color.White);

            spriteBatch.Draw(testMapShot, new Vector2(Viewport.TitleSafeArea.X + 200, Viewport.TitleSafeArea.Y + 100 + 100 * (int)MapSelectChoice.TESTMAP), Color.White);
            spriteBatch.Draw(testMap2Shot, new Vector2(Viewport.TitleSafeArea.X + 200, Viewport.TitleSafeArea.Y + 100 + 100 * (int)MapSelectChoice.TESTMAP2), Color.White);
        }

        public void InputUp()
        {
            if ((int)currentChoice != 1)
            {
                currentChoice--;
                choose.Play();
            }
        }
        public void InputDown()
        {
            if ((int)currentChoice != 3)
            {
                choose.Play();
                currentChoice++;
            }
        }
        public MapSelectChoice InputSelect()
        {
            MapSelectChoice temp = currentChoice;
            currentChoice = MapSelectChoice.TESTMAP;
            return temp;
        }
        public void InputEsc()
        {
            currentChoice = MapSelectChoice.TESTMAP;
            back.Play();
        }
    }
}
